// GLRendererWin32.h
// Matthew DiBernardo
// 04.01.09
//
// Declares the GlRendererWin32 class, a wrapper for OpenGL designed to work
// under Windows. For more information on the purpose and functionality of
// the renderer API wrappers, refer to IRendererAPI.h


#ifndef _GLRENDERERWIN32_H_
#define _GLRENDERERWIN32_H_

#include "IRenderAPI.h"

#include <windows.h>
#include <process.h>

#include <gl.h>
#include <glu.h>

// needs to have dll-interface to be used by clients of class 'GLRendererWin32
// Disabled
#pragma warning(disable: 4251)



class MeshManager;
class AnimationManager;
class DecalManager;
class FBOManager;

class GLRendererWin32 : public IRenderAPI
{
private:
	// Windows System Members
	HINSTANCE _processInst;
	HWND _window;
	HDC	_deviceContext;
	HGLRC _renderContext;

	Matrix4 _cameraTransform;

	// Managers
	FBOManager* _fboManager;
	MeshManager* _meshManager;
	AnimationManager* _animationManager;
	DecalManager* _decalManager;

public:
	GLRendererWin32(void);
	~GLRendererWin32(void);

	virtual bool Init(int argc, char** argv);
	virtual bool Shutdown(void);
	
	virtual void Render3D(const std::vector<IRenderable*>* drawList);
	virtual void Render2D(const std::vector<IRenderable*>* drawList);
	virtual void Begin2D();
	virtual void End2D();
	virtual bool Begin(void);
	virtual bool End(void);

	virtual void Resize(int width, int height);
	
	virtual void SetCameraTransform(Matrix4 transform) { _cameraTransform = transform; }
};

// Header specific functions to be called from elsewhere //
void BindBuffers(const int& meshID, unsigned* meshBufferID, bool fill = true);

void LoadOffsetMatrix(double left, double right, double bottom, double top,
					  double znear, double zfar, float delta, float pz);
///////////////////////////////////////////////////////////

#endif
